# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=jasper
pkgver=3.0.5
pkgrel=0
pkgdesc="Software-based implementation of the codec specified in the emerging JPEG-2000 Part-1 standard"
url="https://www.ece.uvic.ca/~mdadams/jasper/"
arch="all"
license="custom:JasPer2.0"
makedepends="
	cmake
	samurai
	"
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/mdadams/jasper/releases/download/version-$pkgver/jasper-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cmake -B build-jasper -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_SKIP_RPATH=ON \
		-DJAS_ENABLE_OPENGL=ON \
		-DJAS_ENABLE_LIBJPEG=ON \
		-DJAS_ENABLE_AUTOMATIC_DEPENDENCIES=OFF
	cmake --build build-jasper
}

check() {
	cd build-jasper
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build-jasper
}

sha512sums="
1ee8698f13f972a220b9f621bdb48725a93853af52bcaba923c48d67079275e0bcfaee5fc0185bcbe0b68f7d32ea092484c24c21261fcc784949b7b66bdeaef2  jasper-3.0.5.tar.gz
"
